﻿using System.Media;
using System.Threading;
using System.Windows.Forms;

namespace WeaponEvalue.Logic
{
    public class MusicPlayer
    {
        private static readonly SoundPlayer player = new SoundPlayer();

        static MusicPlayer()
        {
            player.SoundLocation = string.Format("{0}\\{1}", Application.StartupPath, "alert.wav");
            player.LoadAsync();
        }

        public static void PlayMusic()
        {
            ThreadPool.QueueUserWorkItem(PlayMusicEx);
        }

        private static void PlayMusicEx(object state)
        {
            player.PlayLooping();
            Thread.Sleep(5000);
            player.Stop();
        }
    }
}
